﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PersonalWebsite.Domain.Abstract.Configuration;
using PersonalWebsite.Domain.Entities.Website;

namespace PersonalWebsite.Domain.Configurations.Website;

public class WS_ShowConfiguration : BaseConfiguration<WS_Show>
{
    public override void Configure(EntityTypeBuilder<WS_Show> builder)
    {
        builder.ToTable(nameof(WS_Show));

        builder.Property(c => c.Name).HasComment(comment: "名称").IsRequired().HasMaxLength(20);
        builder.Property(c => c.Cover).IsUnicode(false).HasComment("封面").IsRequired().HasMaxLength(1000);
        builder.Property(c => c.Link).IsUnicode(false).HasComment("链接").HasMaxLength(1000).IsRequired(false);
        builder.Property(c => c.Score).HasComment("评分").HasMaxLength(5).IsRequired(true);
        builder.Property(c => c.Top).HasComment("票房").HasMaxLength(10).IsRequired(true);
        builder.Property(c => c.Year).HasComment("年份").IsRequired();

        builder.HasIndex(c => c.Year);

        base.Configure(builder);
    }
}